package com.foreverwin.mes.production.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.foreverwin.mes.core.base.FrontPage;
import com.foreverwin.mes.meapi.model.Certification;
import com.foreverwin.mes.production.mapper.StationCertificationMapper;
import com.foreverwin.mes.production.model.StationCertification;
import com.foreverwin.mes.production.service.StationCertificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author syngna
 * @since 2018-11-29
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class StationCertificationServiceImpl extends ServiceImpl<StationCertificationMapper, StationCertification> implements StationCertificationService {


    @Autowired
    private StationCertificationMapper stationCertificationMapper;

    @Override
    public Page<StationCertification> selectPage(FrontPage<StationCertification> frontPage) {
        EntityWrapper<StationCertification> entityWrapper = new EntityWrapper<StationCertification>();
        //getEntityWrapper(entityWrapper, stationCertification);
        return super.selectPage(frontPage.getPagePlus(), entityWrapper);
    }

    @Override
    public List<StationCertification> selectList() {
        EntityWrapper<StationCertification> entityWrapper = new EntityWrapper<StationCertification>();
        //getEntityWrapper(entityWrapper, stationCertification);
        return super.selectList(entityWrapper);
    }

    @Override
    public List<Certification> getCertificationList(String stationBo) {
        return stationCertificationMapper.selectCertificationsByStation(stationBo);
    }

    @Override
    public int deleteCertificationByStation(String stationBo) {
        return stationCertificationMapper.deleteCertificationByStation(stationBo);
    }

    @Override
    public int addCertificationForStation(List<StationCertification> list) {
        return stationCertificationMapper.insertStationCertification(list);
    }


}